﻿using Abp.Dependency;
using Abp.Domain.Uow;
using Abp.EntityFrameworkCore;
using Abp.MultiTenancy;
using Magicodes.Admin.Custom.Fins;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Linq;

namespace Magicodes.Admin.EntityFrameworkCore.Repositories
{
    public  class MonthlyListingRepository: AdminRepositoryBase<MonthlyListing,long>, IMonthlyListingRepository
    { 

        public MonthlyListingRepository(IDbContextProvider<AdminDbContext> dbContextProvider)
            : base(dbContextProvider)
        {
             
        }
         
        public async Task ImportFromExcel(List<MonthlyListing> monthlyListings)
        { 
            //foreach (var item in monthlyListings)
            //{
            //    base.Context.MonthlyListings.Add(item);

            //}
            base.Context.MonthlyListings.AddRange(monthlyListings);

            base.Context.SaveChanges();

           
        }

        public void Get(int year,int month) {

            var query = from m in this.Context.MonthlyListings
                        from o in this.Context.SFQiaoRouteWaybillRoutes
                        where m.SettlementDate.Year == year && m.SettlementDate.Month == month
                        && m.WaybillNumber == o.mailno
                        select m;

        }
    }
}
